package com.lagou.rpc.provider;

import com.lagou.rpc.provider.server.RpcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @description: SpringBoot启动类
 * @author: yx
 * @date: 2022/1/11 14:34
 */
@SpringBootApplication
public class ServerBootStrapApplication implements CommandLineRunner {

    @Autowired
    private RpcService rpcService;

    public static void main(String[] args) {
        SpringApplication.run(ServerBootStrapApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                rpcService.startServer("127.0.0.1", 8899);
            }
        }).start();
    }
}
